#ifndef H_BUILDBUDDY_SYSTEM_COMMAND_H
#define H_BUILDBUDDY_SYSTEM_COMMAND_H

#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>

/**
 * Types
 **/
struct bb_system_command
{
    FILE* pipe_fd;
    char command[512];
    char buffer[1024];
    char* buffer_head;
    char* buffer_tail;
};

/**
 * Init/Uninit
 **/
void bb_system_command_init(struct bb_system_command*, char const* command);
void bb_system_command_uninit(struct bb_system_command*);

/**
 * Actions
 **/
void bb_system_command_start(struct bb_system_command*);
void bb_system_command_finish(struct bb_system_command*);
bool bb_system_command_get_output_line(struct bb_system_command*, char const**, size_t*);

#endif

